/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { KeyCode } from '../model/key_code';
import { Point } from '../model/point';
import { Gesture } from '../event/gesture';

export enum Direct {
    LEFT = 0,
    RIGHT = 1,
    UP = 2,
    DOWN = 3,
}

export interface EventSimulator {
    /**
     * Simulate a single click
     * @param point
     */
    click(point: Point): void;

    /**
     * Simulate a double-click operation
     * @param point
     */
    doubleClick(point: Point): void;

    /**
     * Simulate a long press
     * @param point
     */
    longClick(point: Point): void;

    /**
     * Simulate the input text operation in the input box
     * @param point
     * @param text
     */
    inputText(point: Point, text: string): void;

    /**
     * Simulate a fast-swipe operation
     * @param from
     * @param to
     * @param speed value range [200-40000]
     * @param step swipe step size
     */
    fling(from: Point, to: Point, step: number, speed: number): void;

    /**
     * Simulate a slow swipe operation
     * @param from
     * @param to
     * @param speed value range [200-40000]
     */
    swipe(from: Point, to: Point, speed: number): void;

    /**
     * Simulate drag-and-drop operation
     * @param from
     * @param to
     * @param speed value range [200-40000]
     */
    drag(from: Point, to: Point, speed: number): void;

    /**
     * Simulate key input operation
     * @param key0
     * @param key1
     * @param key2
     */
    inputKey(key0: KeyCode, key1?: KeyCode, key2?: KeyCode): void;

    /**
     * Start ablity to run Hap
     * @param bundleName
     * @param abilityName
     * @returns
     */
    startAblity(bundleName: string, abilityName: string): boolean;

    /**
     * Force stop HAP
     * @param bundleName
     */
    forceStop(bundleName: string): void;

    /**
     * Get the width of the screen
     * @returns
     */
    getWidth(): number;

    /**
     * Get the height of the screen
     * @returns
     */
    getHeight(): number;

    injectGesture(gestures: Gesture[], speed: number): void;
}
